<!-- page heading start-->
<div class="page-heading ng-scope">
	<ul class="breadcrumb">
		<li><a href="#"> 首页 </a></li>
		<li><a href="javascript:void(0);"> 信息发布 </a></li>
		<li class="active"> 信息分类</li>
	</ul>
</div>
<div class="row">
    <div class="col-lg-12">
        <section class="panel">
            <header class="panel-heading"> 
           		<span ng-if="channal.id != null" > 编辑栏目 </span>
            	<span ng-if="channal.id == null" > 添加栏目 </span>
            </header>
            <div class="panel-body">
                <form class="form-horizontal" role="form" name="myForm" id="channalForm">
					<input type="text" ng-hide="true" ng-model="channal.id" name="channal.id">
                    <div class="form-group" ng-class="{'has-error':aForm.cName.$dirty && aForm.cName.$invalid}">
                        <label for="inputTypeName" class="col-lg-2 col-sm-2 control-label">栏目名称</label>
                        <div class="col-lg-10">
                            <input type="text" ng-model="channal.c_name" name="cName" class="form-control" ng-required="true" ng-minlength="2" ng-maxlength="32" placeholder="请输入栏目名称">
						<div ng-show="myForm.cName.$dirty && myForm.cName.$error.minlength" class="alert alert-danger help-block">
							至少要输入2个字符
						</div>
						<div ng-show="myForm.cName.$dirty && myForm.cName.$error.maxlength" class="alert alert-danger help-block">
							不能超过32个字符
						</div>
                        </div>
                    </div>
				
                    <div class="form-group">      <!-- 本栏不需要必选 所以去掉了ng-required="true" 修改时间2017/05/23 yanglj -->
                        <label for="inputTypeValue" class="col-lg-2 col-sm-2 control-label">上级分类</label>
                        <div class="col-lg-10"> 							
                            <select ng-model="channal.c_parent_id" name="chCate" class="form-control"
                                 ng-options="r.id as r.c_name for r in channalList">
                            	<option value="">请选择</option>
							</select>
						<div class="col-sm-13">
							<div class="alert alert-danger help-block">
								如果是根分类可不选择此项
							</div>
						</div>	
                        </div>
					</div> 
					
                    <div class="form-group">
                        <label for="inputTypeValue" class="col-lg-2 col-sm-2 control-label">是否显示</label>
                        <div class="col-lg-10">
                            <label class="radio-inline" ng-init="channal.c_is_show = 1">
							<input type="radio" ng-model="channal.c_is_show" ng-checked="1" name="cIsShow" value="1"/>是
							</label>
							<label class="radio-inline">
								<input type="radio" ng-model="channal.c_is_show" name="cIsShow" value="0"/>否
							</label>
                        </div>
                    </div>
                    
                   <div class="form-group" ng-class="{'has-error':aForm.c_sort.$dirty && aForm.c_sort.$invalid}">
                        <label for="inputTypeValue" class="col-lg-2 col-sm-2 control-label">排序</label>
                        <div class="col-lg-10">
                           <input type="text" ng-pattern="/^[1-9]/"  ng-model="channal.c_sort" 
                           			ng-required="true" name="c_sort" class="form-control" 
                           						ng-minlength="1" ng-maxlength="5" placeholder="请输入排序">
							<div ng-show="myForm.c_sort.$dirty && myForm.c_sort.$error.minlength" class="alert alert-danger help-block">
							至少要输入1个数字
						</div>
						<div ng-show="myForm.c_sort.$dirty && myForm.c_sort.$error.maxlength" class="alert alert-danger help-block">
							不能超过5个数字
						</div>
							 <div 
                            ng-show="myForm.c_sort.$dirty && myForm.c_sort.$error.pattern" class="alert alert-danger help-block">必须为数字</div>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="inputTypeValue" class="col-lg-2 col-sm-2 control-label">栏目描述</label>
                        <div class="col-lg-10">
						<textarea ck-editor name="chDe" ng-model="channal.c_description" ng-required="true" ng-minlength="1" ng-maxlength="200"></textarea>
                            <div ng-show="myForm.chDe.$dirty && myForm.chDe.$invalid" class="alert alert-danger help-block">
							必须填写，200字以内
						</div>
                        </div>
                    </div>
				
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                        	<button type="submit" class="btn btn-danger"  ng-disabled="myForm.$invalid" ng-click="channal.id !=null ? update() : save()">保存</button>
							<button type="button" class="btn btn-default" ng-click="back()">取消</button>
                        </div>
                    </div>
                    
                </form>
            </div>
        </section>
    </div>
</div>
